#ifndef MULTISPRITE_H
#define MULTISPRITE_H
#include <iostream>
#include "sprite.h"
#include "gamedata.h"
#include <string>
using std::string;

class MultiSprite : public Sprite {
public:
  MultiSprite(const Vector2f& pos, const Vector2f vel, const Frame* fm,const std::string& prefix) : 
    Sprite(pos, vel, fm),
    currentFrame(0),
    numberOfFrames(gameData->getXmlInt(prefix+"Frames")),
    frameInterval(gameData->getXmlInt(prefix+"FrameInterval"))
  {}
  ~MultiSprite(){cout<<"delete MultiSprite"<<endl;}

  virtual const Frame* getFrame() const { return &frame[currentFrame]; }
  void draw() const { frame[currentFrame].draw(X(), Y()); }
  void update(Uint32 ticks);
  void advanceFrame(Uint32 ticks);
protected:
  unsigned currentFrame;
  unsigned numberOfFrames;
  unsigned frameInterval;
private:

  MultiSprite(const MultiSprite&);
  MultiSprite& operator=(const MultiSprite&);
};

#endif
